﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Data
{
    public abstract class Character
    {
        public int life, attack, range, defense, speed, attackSpeed, specialAttack, mana,maxLife, maxMana;
        public string name, imgSelection,sprite, hudicon;
        public int spriteX = 32;
        public int spriteY = 48;

        /// <summary> fait le calcul des dmg/défense 
        /// enleve la vie
        /// et renvoie les dégats subits
        /// </summary>
      
       public int LooseLife(int dmg)
        {

            float playerDefense = (float)defense;
            float dmgDeal = dmg * (playerDefense / 100);
            float realAttack = Attack((int)dmgDeal);
            life -= (int)realAttack;
            if (life <= 0)
                life = 0;
            return (int)realAttack;
        }

       public int Attack(int dmg, bool specAttack = false)
       {
           Random r = new Random();
           int crit = r.Next(200);

           if (crit > 100)
           {
               dmg += crit;
           }
           else
           {
               dmg -= crit;     
           }
            
           return dmg;
       }


        
    }
}
